package org.roulette.controller;
import java.util.Timer;
import java.util.TimerTask;

public class TimerJob {
	Timer timer;
	int counter;
	Updater u = new Updater();
	
	public TimerJob(){
		timer = new Timer();
		timer.schedule(new DoTimerJob(), 0, 1000);
		
	}
	
	class DoTimerJob extends TimerTask {

		@Override
		public void run() {
			counter++;
			if(counter % 5 == 0){
				System.out.println(counter);
			}
			
			u.updateTimer(counter);
			if(counter == 30){
				
				System.out.println("updating game");
				u.updateGame();
				counter = 0;
			}		
		}
	}
}
